package com.ap.core.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.ap.core.dao.AbstractAPCoreBaseJpaDao;
import com.ap.core.dao.ZappUserDao;
import com.ap.core.domain.ZappConsumerUser;
import com.ap.core.domain.ZappUser;

/**
 * User: Ranjit.Singh
 * Jpa Implementation class for {@link com.ap.core.dao.ZappUserDao}
 */
public class JpaZappUserDao extends AbstractAPCoreBaseJpaDao<ZappUser, Long> implements ZappUserDao{

    /* (non-Javadoc)
     * @see com.ap.core.dao.GenericDao#findById(java.lang.Object)
     */
    @Override
    public ZappUser findById(Long primaryKey) {
        return findById(ZappUser.class, primaryKey);
    }

	/* (non-Javadoc)
	 * @see com.ap.core.dao.ZappUserDao#getZappUserByEmailId(java.lang.String)
	 */
	@Override
	public ZappUser getZappUserByEmailId(String zappEmailId) {
		Criteria criteria = getSession().createCriteria(ZappUser.class);
		criteria.add(Restrictions.eq("zappEmailId", zappEmailId));
		return (ZappUser) criteria.uniqueResult();
	}

}
